package com.pope.framework.constants;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

@Getter
public enum CompareEnum {
	GT("1","大于"),
	GT_EQ("2","大于等于"),
	LT("3","小于"),
	LT_EQ("4","小于等于"),
	RANGE_ALL_CLOSE("5","全闭"),
	RANGE_ALL_OPEN("6","全开"),
	RANGE_LEFT_OPEN("7","区间(左开右闭)"),
	RANGE_RIGHT_OPEN("8","区间(左闭右开)");
	private String code;
	private String name;
	
	CompareEnum(String code,String name){
		this.code=code;
		this.name=name;
	}
	
	public static String getNameByCode(String code) {
		if(StrUtil.isBlank(code)) {
			return "";
		}
		for(CompareEnum e:CompareEnum.values()) {
			if(e.getCode().equals(code)) {
				return e.getName();
			}
		}
		return "";
	}
}
